package com.coupon.controller;

import com.common.domain.vo.UserCouponListByStatusVO;
import com.common.result.Result;
import com.coupon.service.UserCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 路亚
 * @version 0.1
 * @className UserCouponController
 * @description
 * @date 2024/12/22 16:59
 * @since jdk11
 */
@RestController
@RequestMapping("/userCoupon")
@Slf4j
@RequiredArgsConstructor
@Api(tags = "用户优惠券管理")
public class UserCouponController {

    private final UserCouponService userCouponService;

    @GetMapping("/getCoupon")
    @ApiOperation("/领取优惠卷")
    public Result getCoupon(Long couponId){
        userCouponService.getCoupon(couponId);
        return Result.success();
    }

    @GetMapping("/listByStatus")
    @ApiOperation("/根据状态查询优惠卷")
    public Result listByStatus(Integer status, Integer page){
        UserCouponListByStatusVO  result = userCouponService.listByStatus(status, page);
        return Result.success(result);
    }
}
